﻿using eCommMongo.Core;
using eCommMongo.Core.Data;
using eCommMongo.Core.Domain.Shops;

namespace eCommMongo.Service.Shops
{
    public class ShopMapper
    {
        public static Shop ToShop(string shopId)
        {
            if (string.IsNullOrEmpty(shopId))
            {
                return null;
            }
            else
            {

                var shopRep = EngineContext.Current.Resolve<IMongoRepository<Shop>>();

                var shopObj = shopRep.GetById( shopId);

                return new Shop()
                {
                    Id = shopId,
                    ShopName = shopObj.ShopName,
                };
            }
        }
    }
}